using System;
using BaseAmd.BaseDevice;
using SqlSugar;

namespace SiemensAmd.Mmt.DevQt
{
	[SugarTable("tool_device_cache")]
	public class ToolDeviceCacheEntity
	{
		[SugarColumn(ColumnName = "id", IsPrimaryKey = true, IsIdentity = true)]
		public int Id { get; set; }

		[SugarColumn(ColumnName = "mmt_pk_toolplace")]
		public long DbIdTDIToolPlace { get; set; }

		[SugarColumn(ColumnName = "mmt_pk_tooldata_details")]
		public long DbIdTDIToolDataDetails { get; set; }

		[SugarColumn(ColumnName = "mmt_pk_tooldata")]
		public long DbIdTDIToolData { get; set; }

		[SugarColumn(ColumnName = "user_data")]
		public string UserData { get; set; }

		[SugarColumn(ColumnName = "fmc_no")]
		public string FMCNo { get; set; }

		[SugarColumn(ColumnName = "fixed_location")]
		public bool FixedLocation { get; set; }

		[SugarColumn(ColumnName = "device_no")]
		public string DeviceNo { get; set; }

		[SugarColumn(ColumnName = "tool_type")]
		public int ToolType { get; set; }

		[SugarColumn(ColumnName = "tool_ident")]
		public string ToolIdent { get; set; }

		[SugarColumn(ColumnName = "tool_no")]
		public int ToolNo { get; set; }

		[SugarColumn(ColumnName = "duplo_no")]
		public int DuploNo { get; set; }

		[SugarColumn(ColumnName = "tool_in_mag")]
		public int ToolInMag { get; set; }

		[SugarColumn(ColumnName = "tool_in_place")]
		public int ToolInPlace { get; set; }

		[SugarColumn(ColumnName = "tool_mon")]
		public int ToolMon { get; set; }

		[SugarColumn(IsIgnore = true)]
		public string ToolMonDescribe => this.ToolMon switch
		{
			0 => "", 
			1 => "T", 
			2 => "C", 
			4 => "W", 
			8 => "W2", 
			_ => "", 
		};

		[SugarColumn(ColumnName = "tool_place_spec")]
		public int ToolPlaceSpec { get; set; }

		[SugarColumn(ColumnName = "num_cutt_edges")]
		public int NumCuttEdges { get; set; }

		[SugarColumn(ColumnName = "edge_index")]
		public int EdgeIndex { get; set; }

		[SugarColumn(ColumnName = "edge_position")]
		public int EdgePosition { get; set; }

		[SugarColumn(ColumnName = "dno")]
		public int DNo { get; set; }

		[SugarColumn(ColumnName = "master_use")]
		public bool MasterUse { get; set; }

		[SugarColumn(ColumnName = "is_empty")]
		public bool IsEmpty { get; set; }

		[SugarColumn(ColumnName = "tool_state")]
		public int ToolState { get; set; }

		[SugarColumn(ColumnName = "place_state")]
		public int PlaceState { get; set; }

		[SugarColumn(ColumnName = "left_size")]
		public int LeftSize { get; set; }

		[SugarColumn(ColumnName = "right_size")]
		public int RightSize { get; set; }

		[SugarColumn(ColumnName = "top_size")]
		public int TopSize { get; set; }

		[SugarColumn(ColumnName = "bottom_size")]
		public int BottomSize { get; set; }

		[SugarColumn(ColumnName = "length1")]
		public decimal Length1 { get; set; }

		[SugarColumn(IsIgnore = true)]
		public decimal Diameter => Math.Round(this.Radius1 * 2m, 3);

		[SugarColumn(ColumnName = "radius1")]
		public decimal Radius1 { get; set; }

		[SugarColumn(ColumnName = "corner_radius")]
		public double CornerRadius { get; set; }

		[SugarColumn(ColumnName = "wear_length")]
		public double WearLength { get; set; }

		[SugarColumn(ColumnName = "wear_length1")]
		public double WearLength1 { get; set; }

		[SugarColumn(ColumnName = "edge_wear_set")]
		public double EdgeWearSet { get; set; }

		[SugarColumn(ColumnName = "edge_wear_limit")]
		public double EdgeWearLimit { get; set; }

		[SugarColumn(ColumnName = "edge_wear_actual")]
		public double EdgeWearActual { get; set; }

		[SugarColumn(ColumnName = "wear_radius1")]
		public double WearRadius1 { get; set; }

		[SugarColumn(ColumnName = "life_quality_set")]
		public int LifeQualitySet { get; set; }

		[SugarColumn(ColumnName = "life_quality_remain")]
		public int LifeQualityRemain { get; set; }

		[SugarColumn(ColumnName = "life_limit")]
		public int LifeLimit { get; set; }

		[SugarColumn(ColumnName = "work_count_set")]
		public int WorkCountSet { get; set; }

		[SugarColumn(ColumnName = "work_count_remain")]
		public int WorkCountRemain { get; set; }

		[SugarColumn(ColumnName = "work_count_limit")]
		public int WorkCountLimit { get; set; }

		[SugarColumn(ColumnName = "time_stamp")]
		public DateTime TimeStamp { get; set; }

		[SugarColumn(IsIgnore = true)]
		public DbCompareRetEnum? RowState { get; set; }
	}
}
